﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using NewDDSys.Entity;
using NewDDSys.IBLL;
using NewDDSys.IDAL;
using NewDDSys.Factory;
using NewDDSys.Utility;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class Web_XKCDT : System.Web.UI.Page
{
    private string num = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        btnOK.Attributes.Add("onclick", "javascript:if(confirm('" + "确认无误，并提交么？" + "')== false) return false;");
    }
    protected void btnPGCX_Click(object sender, EventArgs e)
    {
        Response.Redirect(string.Format("PGCX.aspx?Pinzhong={0}", "线材"));
        txtPinzhong.Text = Request.QueryString["Pinzhong"];
        txtPinzhong.Attributes["contentEditable"] = "false";
        txtGuige.Text = Request.QueryString["Guige"];
        txtGuige.Attributes["contentEditable"] = "false";
        num = Request.QueryString["Num"];
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        int checkValue = 0;
        XkcdtInfo xc = new XkcdtInfo();
        xc.Num = num;
        xc.Banzu = Session["用户信息.班组"].ToString();
        xc.Tianbao = Session["用户信息.姓名"].ToString();
        xc.Kday = DateTime.Now.ToString();
        string dh = "";
        switch (Session["用户信息.部门"].ToString())
        {
            case "一高线":
                dh = "YG"; break;
            case "二高线":
                dh = "EG"; break;
            case "大棒线":
                dh = "DB"; break;
            case "四轧库":
                dh = "SZ"; break;
            default:
                break;
        }
        xc.Dtnum = dh + xc.Kday;
        checkValue = BLLFactory.CreateXkcdtBLL().Add(xc);
        if (checkValue >= 1)
        {
            Response.Write(" <script   language=javascript> window.alert( ' 提交成功！ ');</script> ");
        }
        if (txtKN.Text.ToString() != "")
            BLLFactory.CreateXkcdtBLL().UpdateKN(xc.Dtnum, Convert.ToDecimal(txtKN.Text.ToString()));
        if (txtDK.Text.ToString() != "")
            BLLFactory.CreateXkcdtBLL().UpdateDK(xc.Dtnum, Convert.ToDecimal(txtDK.Text.ToString()));
        Response.Redirect("XKCDTJL.aspx");

    }
    protected void btnRepeat_Click(object sender, EventArgs e)
    {
        txtKN.Text = "";
        txtDK.Text = "";
    }
}
